I want to check the existence of image ... how to do this can anyone help me..
@if (Server.MapPath("~/Content/Images/UserImage/" +Model.ID + ".png"))
{
<img src="~/Content/Images/UserImage/" + @Model.ID + ".png" alt="@Model.FirstName">
}
Thanks..
Home / DeveloperSection / Forums / Checking if file exists in asp.net mvc 4
I want to check the existence of image ... how to do this can anyone help me..
@if (Server.MapPath("~/Content/Images/UserImage/" +Model.ID + ".png"))
{
<img src="~/Content/Images/UserImage/" + @Model.ID + ".png" alt="@Model.FirstName">
}
Thanks..
Anonymous User
16-Mar-2018Try this am sure this will solve your problem